Particle systems and lights are the two effects you control from code, and both are built from real sprites, so both spend from the same hardware budgets as everything else.
An effect is something that makes the screen look alive without being a character or a piece of scenery: sparks, smoke, a torch that lights up a dark cave. This category holds two kinds:
Both are described in more depth on Particles and lighting. This page is the map: what exists, how you use it, and what it costs.
A few other visual effects live in other categories and are listed at the end.
A particle is one small sprite that moves, changes and disappears on its own. A particle system, called an effect in the project, is a recipe for making them: how many, how fast, which direction, which sprite, how long they live. You do not write the recipe in code. You draw and tune it in the editor's Particles tab, where it is saved under a name, like fx_spark. Code only starts it.
| Function | Does |
|---|---|
effect_burst(sys, x, y) | fires one burst at a position and forgets it. A hit spark, a puff of dust. Nothing to stop |
effect_start(sys, x, y) | starts a system that keeps running for as long as the instance that started it exists. Call it again to move it |
effect_start_room(sys, x, y) | the same, but the room owns it: it outlives the instance and ends when the room changes |
effect_stop(sys) | puts out a system early. Particles already in the air finish their own lives |
// Step event of a gun: a spark where the shot lands
if (btn_pressed(BTN_A)) {
effect_burst(fx_spark, x, y);
}A running system belongs to the instance that started it, so there is nothing to keep and nothing to forget: destroy the instance, or change room, and the system stops by itself and its slot comes back. You only need effect_stop to put one out while the instance carries on. Asking for an effect an instance is already running moves it instead of starting a second one, so calling effect_start every Step makes an effect follow something.
One effect can have up to 3 emitters (up to 8 if you raise Emitters in one effect under Engine limits in Project Settings), which are separate streams that run together: a campfire's flames, and its smoke.
Every particle is a real hardware sprite. The engine limits itself so it can never overrun the hardware. The numbers below are what every game starts with; each is a box under Engine limits in Project Settings, and the Particles tab preview uses your project's numbers:
| Limit | Value |
|---|---|
| Live particles, across every effect at once | 24 |
Systems running at once (effect_start) | 6 |
| Emitters in one effect | 3 |
Past the limit, a new particle is dropped. There is no error and no crash, so a too-generous burst just looks thinner. The particles (24 unless you changed it) still come out of the same 128 sprites the hardware draws each frame, so they compete with everything else on screen. Budgets lists those.
Two hardware facts shape how particles look:
An effect may also ask for a blend, meaning added-together or see-through drawing. The hardware has one blend setting for the whole screen. Only the first blended effect to run gets it, and any other renders plain. A dark room also uses the blend setting, so blends downgrade to plain there.
A room can be marked shrouded. That is a dark overlay over the whole room, and it is a room setting rather than something in code. Its darkness is also a setting. A light cuts a hole in that overlay, so the area around it shows at full brightness.
| Function | Does |
|---|---|
shroud_cutout(radius, flicker) | makes this instance a light with a round hole. flicker makes it pulse |
shroud_cutout_sprite(mask, scale, flicker) | the hole takes the shape of a sprite you supply, at a scale |
shroud_cutout_sprite_angle(mask, scale, flicker, angle) | the same, and the shape can be turned |
The hole follows the instance every frame, so a light on a moving instance needs no per-frame call. Calling any attach function again replaces the light rather than adding a second, and shroud_cutout(0, false) switches it off.
Things worth knowing:
camera_shake jolts the whole screen. See The camera.room_change_ext plays one of 15 named transitions while the room changes. Most of them use the hardware's window and fade features, so they cost no sprites. The blinds and the comb, when they wipe sideways, use one extra background layer while they play.| Entry | What it is |
|---|---|
effect_burst, effect_start, effect_start_room, effect_stop | run a particle system |
shroud_cutout, shroud_cutout_sprite, shroud_cutout_sprite_angle | turn an instance into a light |